/*-------------------------------------------------------- 
* Module Name : OLModalBackground
* Version : 1.0
* 
* Software Name : Qt App Template
* Version : 1.0
*
* Copyright � 2010 � 2011 France T�l�com
* This software is distributed under the LGPL v2.1 license,
* the text of which is available at http://www.gnu.org/licenses/lgpl-2.1.html
* or see the "LICENSE.txt" file for more details.
*
*--------------------------------------------------------
* File Name   : OLModalBackground.h
*
* Created     : 07 June 2011
* Author(s)   : Omer Saleem
*
* Description :
* The base class modal background surface for various modal
* UI elements used by the framework. Provides a fading
* semi-transparent background to move application to
* background.
*
*--------------------------------------------------------
* 1.0 - First open source release
*
*/

#ifndef OLMODALBACKGROUND_H
#define OLMODALBACKGROUND_H

#include <QtGui/QWidget>
#include <QtGui/QPixmap>

class OLModalBackground : public QWidget
{
    Q_OBJECT
    Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity);

public:
    explicit OLModalBackground(QWidget *parent = 0);

    void setOpacity(qreal opacity);
    qreal opacity();

#ifdef OL_BLUR_BACKGROUND
public slots:
    void setBackgroundPixmap(QPixmap& pixmap);
#endif

signals:
    void clicked();

protected:
    void paintEvent(QPaintEvent* e);
    void mousePressEvent(QMouseEvent* e);
    void mouseReleaseEvent(QMouseEvent* e);
    void mouseMoveEvent(QMouseEvent* e);
    bool event(QEvent *e);

private:
    qreal m_opacity;
#ifdef OL_BLUR_BACKGROUND
    QPixmap* m_background;
#endif
};

#endif // OLMODALBACKGROUND_H
